﻿#pragma once
/**
@author 何炜
@date 2010/5/4
@brief .
@details
*/

#ifdef GLL_DEBUG
#	ifdef GLL_WIN
#		define GLL_BreakPoint	__asm int 3
#	endif
#else 
#		define GLL_BreakPoint
#endif

namespace GLL
{
	namespace Debug
	{

		void Log2Console(const utf8* _fomat_str, ...);
		void Log2Console(const char* _fomat_str, ...);

		class WndPopup
		{
		public:
			void Show(const String& msg, const char* cpp_file_name="", long cpp_file_line=0, bool ExitGame = true );
			void Show(const char* Message, const char* cpp_file_name="", long cpp_file_line=0, bool ExitGame = true );
			void Show(StringStream& strm, const char* cpp_file_name="", long cpp_file_line=0, bool ExitGame = true );

			void Show(const String& msg, bool ExitGame);
			void Show(const char* Msg, bool ExitGame);
			void Show(StringStream& strm, bool ExitGame);

		public:
			bool IsInError(){return mErrorHappend;}
			bool IsExiting(){return mExit;}
			void SetError(bool Exit){mErrorHappend=true;mExit = Exit;}
			void ResetError(){mErrorHappend=mExit = false;}
			WndPopup(){ ResetError();}

		private:
			void DoPopup( bool ExitGame, std::stringstream& str );
			bool mErrorHappend;
			bool mExit;
		};

		extern WndPopup osPopup;

	};//Debug
};//GLL

#ifndef GLL_LOG
#define  GLL_LOG(str, ...)	{GLL::Debug::Log2Console(str, __VA_ARGS__);}
#endif
